new Vue({
    el: '#app',
    data: {
        active: 3,
        user: {},
        order: {},
        data: {},
    },
    mounted: function () {
        this.main();
    },
    methods: {
        main: function () {
            var _this = this;
            $http.post('/member/api.users/getcenterinfo.html', {}).then(function (res) {
                var _a = res.data, orderStats = _a.orderStats, userInfo = _a.userInfo;
                _this.order = orderStats;
                _this.user = userInfo;
                _this.data = res.data;
            });
        },
        // 代理商申请
        onRegion: function () {
            var _this = this;
            $http.post('/member/api.users/getUserRegion', {}).then(function (res) {
                if (res.data.code == 0) {
                    return _this.$toast(res.data.msg);
                }
                window.location.href = './user_region.html';
            });
        },
        onStore: function () {
            var _this = this;
            $http.post('/member/api.users/getStore', {}).then(function (res) {
                if (res.data.code == 0) {
                    return _this.$toast(res.data.msg);
                }
                window.location.href = './distribution_store.html';
            });
        },
        // 门店申请
        onLogout: function () {
            var _this = this;
            $http.post('/api/user/logout', {}).then(function (res) {
                if (res.data.code != 1) {
                    return _this.$toast(res.data.msg);
                }
                _this.$toast.success({
                    message: "注销成功",
                    onClose: function () { window.location.href = './login.html'; }
                });
            });
        }
    }
});
